package com.school.manager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.school.manager.domaim.TecStuCourse;
import com.school.manager.entity.po.TecStuCoursePo;
import com.school.manager.entity.vo.TecStuCourseVo;
import com.school.manager.mapper.TecStuCourseMapper;
import com.school.manager.service.ITecStuCourseService;
import com.school.manager.utils.PageUtil;

import lombok.extern.slf4j.Slf4j;

/**
 * description：教师学生课程业务实现类
 * date：2021/10/133:18 下午
 */

@Service
@Slf4j
public class TecStuCourseServiceImpl extends ServiceImpl<TecStuCourseMapper, TecStuCourse> implements ITecStuCourseService {
	
	@Autowired
    private TecStuCourseMapper tecStuCourseMapper;
	
	@Override
	public Page<TecStuCourseVo> page(TecStuCoursePo tecStuCoursePo) {
		QueryWrapper<TecStuCourse> queryWrapper = PageUtil.buildQueryWrapper(tecStuCoursePo, TecStuCourse.class);
        Page<TecStuCourse> page = new Page<>(tecStuCoursePo.getCurrent(), tecStuCoursePo.getSize());
        tecStuCourseMapper.selectPage(page, queryWrapper);
        return PageUtil.buildPage(page, TecStuCourseVo.class);
	}

	@Override
	public List<TecStuCourseVo> myCourse(String userId) {
		return tecStuCourseMapper.myCourse(userId);
	}
	
	

}
